import request from '@/utils/request';

const URL = '/plugin';
// 测试接口
const DemoAPI = {

    getPlugins (queryParams?: any) {
        return request<any> ({
            url: `${URL}/queryPluginList`,
            method: 'GET',
            params: queryParams,
        })
    },
    importFileChunk (formData: FormData) {
        return request({
            url: '/dataImport/uploadChunk',
            method: 'post',
            data: formData,
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        })
    },
    mergeChunks (formData: FormData) {
        return request({
            url: '/dataImport/mergeChunks',
            method: 'post',
            data: formData,
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        })
    },
    // 分片上传
    uploadChunkByParamConfig(formData: FormData){
        return request({
            url: '/dataImport/uploadChunkByParamConfig',
            method: 'post',
            data: formData,
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        })
    },
    // 合并文件
    mergeChunksByParamConfig(formData: FormData) {
        return request({
            url: '/dataImport/mergeChunksByParamConfig',
            method: 'post',
            data: formData,
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        })
    },
    // 删除文件接口
    removeChunkFiles(queryParams:any) {
        return request({
            url: '/dataImport/removeChunkFiles',
            method: 'GET',
            params: queryParams,
        })
    },
    tinkerGetPlugins(queryParams?:any){
        return request<any> ({
            url: `${URL}/tinker/tinkerQueryPluginList`,
            method: 'GET',
            params: queryParams,
        })
    }
}

export default DemoAPI;
